var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && d == 0) {
        im.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        im.dispose()
    } else {
        if (status === a++) {
            im.curNodeEventEnd(true);
            im.setInGameDirectionMode(true, false, false);
            im.setStandAloneMode(true);
            im.inGameDirectionEvent_SetAdditionalEffectVisibleForInGameDirection();
            im.sendNormalTalk_Bottom("#face6##b(治疗药的苦味在嘴里蔓延。是的，我一睁眼的时候就是这个味道。)#k", 37, 3001270, false, true, 1)
        } else {
            if (status === a++) {
                im.sendNormalTalk_Bottom("#face6##b(突然回想起从前，在长久的噩梦中惊醒，第一次遇到支部长的那天。)#k", 37, 3001270, true, true, 1)
            } else {
                if (status === a++) {
                    im.fieldEffect_InsertCanvas(1, 255, 0, 0, 0, 500, 0);
                    im.inGameDirectionEvent_AskAnswerTime(500)
                } else {
                    if (status === a++) {
                        im.fieldEffect_Hero9(0, 2000);
                        im.inGameDirectionEvent_AskAnswerTime(2000)
                    } else {
                        if (status === a++) {
                            im.fieldEffect_PlayBGM("Bgm00.img/Silence", 0, 0);
                            im.fieldEffect_ProcessOnOffLayer("00", "Effect/Direction19.img/effect/cadena_dir/0", 0, 900, 0, -80, 12, 4, 0, -1, 0, 0, 0);
                            im.inGameDirectionEvent_AskAnswerTime(1000)
                        } else {
                            if (status === a++) {
                                im.sendNormalTalk_Bottom("#face8#放手，我要赶快到城堡去！", 37, 3001270, false, true, 1)
                            } else {
                                if (status === a++) {
                                    im.effect_Voice("Voice3.img/cadena/Q2/Female/0", 128);
                                    im.sendNormalTalk_Bottom("#face9#现在不是优柔寡断的时候！", 37, 3001270, true, true, 1)
                                } else {
                                    if (status === a++) {
                                        im.effect_Voice("Voice3.img/cadena/Q2/Female/1", 128);
                                        im.sendNormalTalk_Bottom("#face2#镇定点，快醒醒！", 37, 3001250, true, true, 1)
                                    } else {
                                        if (status === a++) {
                                            im.sendNormalTalk_Bottom("#face2#……那一日的惨剧导致王族灭亡。而你是唯一的幸存者。", 37, 3001250, true, true, 1)
                                        } else {
                                            if (status === a++) {
                                                im.fieldEffect_ProcessOnOffLayer("00", "", 2, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                                                im.fieldEffect_ProcessOnOffLayer("01", "Effect/Direction19.img/effect/cadena_dir/1", 0, 900, 0, -80, 12, 4, 0, -1, 0, 0, 0);
                                                im.sendNormalTalk_Bottom("#face10#你说什么？", 37, 3001270, true, true, 1)
                                            } else {
                                                if (status === a++) {
                                                    im.effect_Voice("Voice3.img/cadena/Q2/Female/2", 128);
                                                    im.sendNormalTalk_Bottom("#face2#所有人都死了，看来这件事已经过去好久了。看来是你运气好被近卫队长赏识，才逃出了城堡。", 37, 3001250, true, true, 1)
                                                } else {
                                                    if (status === a++) {
                                                        im.sendNormalTalk_Bottom("#face10#……", 37, 3001270, true, true, 1)
                                                    } else {
                                                        if (status === a++) {
                                                            im.sendNormalTalk_Bottom("#face2#……后来你受到严重撞伤，陷入了昏迷……近卫队长带着只剩半条命的你来到这里。", 37, 3001250, true, true, 1)
                                                        } else {
                                                            if (status === a++) {
                                                                im.sendNormalTalk_Bottom("#face2#那时再晚一步就危险了。吃下治疗药才算得救了。不过药物引发的副作用一直持续到现在……", 37, 3001250, true, true, 1)
                                                            } else {
                                                                if (status === a++) {
                                                                    im.sendNormalTalk_Bottom("#face10#为什么……单单救了我呢？", 37, 3001270, true, true, 1)
                                                                } else {
                                                                    if (status === a++) {
                                                                        im.effect_Voice("Voice3.img/cadena/Q2/Female/3", 128);
                                                                        im.sendNormalTalk_Bottom("#face2#放心吧，我不是白白帮你。因为之前欠近卫队长一个人情，这次算是抵消了。记得好好谢谢人家。", 37, 3001250, true, true, 1)
                                                                    } else {
                                                                        if (status === a++) {
                                                                            im.fieldEffect_ProcessOnOffLayer("01", "", 2, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                                                                            im.fieldEffect_ProcessOnOffLayer("02", "Effect/Direction19.img/effect/cadena_dir/2", 0, 900, 0, -80, 12, 4, 0, -1, 0, 0, 0);
                                                                            im.inGameDirectionEvent_AskAnswerTime(500)
                                                                        } else {
                                                                            if (status === a++) {
                                                                                im.sendNormalTalk_Bottom("#face2#总之我遵守了诺言。现在没义务再保护你了。今后你好自为之吧。", 37, 3001250, false, true, 1)
                                                                            } else {
                                                                                if (status === a++) {
                                                                                    im.fieldEffect_ProcessOnOffLayer("02", "", 2, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                                                                                    im.fieldEffect_InsertCanvas(1, 255, 0, 0, 0, 0, 0);
                                                                                    im.inGameDirectionEvent_AskAnswerTime(1200)
                                                                                } else {
                                                                                    if (status === a++) {
                                                                                        im.fieldEffect_InsertCanvas(0, 0, 0, 0, 0, 1000, 0);
                                                                                        im.inGameDirectionEvent_AskAnswerTime(1400)
                                                                                    } else {
                                                                                        if (status === a++) {
                                                                                            im.sendNormalTalk_Bottom("#face0##b(醒后就到支部长手下做事已经是后来的事了。不可一世的王族也好，没出息的胆小鬼也好，那都是过去的事了。现在连王族时的名字也不要了……)#k", 37, 3001270, false, true, 1)
                                                                                        } else {
                                                                                            if (status === a++) {
                                                                                                im.effect_Voice("Voice3.img/cadena/Q2/Female/4", 128);
                                                                                                im.sendNormalTalk_Bottom("#face0##b(我决定以寓意锁链的卡德娜的名义活下去。要用手中的锁链把妨碍我的人碎尸万段……)#k", 37, 3001270, true, true, 1)
                                                                                            } else {
                                                                                                if (status === a++) {
                                                                                                    im.effect_Voice("Voice3.img/cadena/Q2/Female/5", 128);
                                                                                                    im.sendNormalTalk_Bottom("#face0##b(我只想让自己变得更强。无论使用任何手段，即使做尽坏事我也甘愿。我要踩着商团一步步往上爬。)#k", 37, 3001270, true, true, 1)
                                                                                                } else {
                                                                                                    if (status === a++) {
                                                                                                        im.effect_Voice("Voice3.img/cadena/Q2/Female/6", 128);
                                                                                                        im.sendNormalTalk_Bottom("#face0##b(我要不断变强，变强大……总有一天，要登上那黑暗顶端。牢记那一日的决心……还有伤痛……)#k", 37, 3001270, true, true, 1)
                                                                                                    } else {
                                                                                                        if (status === a++) {
                                                                                                            im.effect_Voice("Voice3.img/cadena/Q2/Female/7", 128);
                                                                                                            im.inGameDirectionEvent_ForcedFlip15(700, 0, 0, 0, 0);
                                                                                                            im.setInGameDirectionMode(false, true, false);
                                                                                                            im.setStandAloneMode(false);
                                                                                                            im.updateInfoQuest(34603, "clear=1");
                                                                                                            im.dispose()
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};